/**
 * 
 */
package sourceFiles;

import Exceptions.InvalidChildID;
import Exceptions.InvalidRideId;
import Exceptions.TicketDoesntExist;
import Exceptions.CentralComputerExceptions.ChildAgeDoesntMatch;
import Exceptions.CentralComputerExceptions.ChildDoesntHaveTicket;
import Exceptions.CentralComputerExceptions.ChildHeightDoesntMatch;
import Exceptions.CentralComputerExceptions.ChildIDDoesntExist;
import Exceptions.CentralComputerExceptions.RideIDDoesntExist;
import RideExceptions.ChildAlreadyInRideException;
import RideExceptions.RideActiveException;

/**
 * A class representing a simple entrance gate in the park. an entrance gate can
 * open, close, and pass a child through it (after a confirmation sequence), and
 * notify the parent RIde that a child want to enter it. Inherited from Gate
 * class.
 * 
 * @author LASO-Team
 * 
 */
public class EntranceGate extends Gate {

	/**
	 * A simple constructor for the parameters of the entrance gate (a Gate is
	 * closed upon creation)
	 * 
	 * @param ride
	 */
	public EntranceGate(IRide ride) {
		super(ride);
	}

	/* (non-Javadoc)
	 * @see sourceFiles.Gate#passThroughGate(java.lang.Integer)
	 */
	public void passThroughGate(Integer childID) throws RideActiveException,
			InvalidChildID, ChildAlreadyInRideException, ChildIDDoesntExist,
			InvalidRideId, ChildHeightDoesntMatch, ChildAgeDoesntMatch,
			ChildDoesntHaveTicket, RideIDDoesntExist, TicketDoesntExist {
		if (!IsGateOpened()) {
			throw new RideActiveException();
		}
		getRide().childEntersRide(childID);
	}

}
